import { createSSRApp } from "vue";
import App from "./App.vue";
import shareMixin from "@/utils/shareMixin";
// 引入全局样式
import "@/styles/index.scss";

// 引入pinia
import pinia from "@/store";

// 引入uview
import uviewPlus from 'uview-plus'

export function createApp() {
  const app = createSSRApp(App);

  // 挂载插件
  app.use(pinia);
  app.use(uviewPlus);
  app.mixin(shareMixin);

  // 在插件挂载后获取 uview-plus 版本
  app.mount('#app'); // 确保应用已经挂载后

  setTimeout(() => {
    if (uni.$u && uni.$u.config) {
      console.log("当前项目uview-plus版本：" + uni.$u.config.v);
    } else {
      console.error("uview-plus未正确初始化");
    }
  }, 100);  // 使用延时来确保插件初始化
  

  return {
    app,
  };
}
